# coding=utf-8
# -*- coding: UTF-8 -*-
#
# This file is part of the kernelstudio package.
#
# (c) 2014-2025 zlin <admin@kernelstudio.com>
#
# For the full copyright and license information, please view the LICENSE file
# that was distributed with this source code.

from abc import ABC, abstractmethod
from collections.abc import Generator


class StorageProvider(ABC):
    def __init__(self):
        pass

    @abstractmethod
    def save(self, filename: str, data: bytes) -> bool:
        raise NotImplementedError

    @abstractmethod
    def stream(self, filename: str, filepath: str) -> Generator:
        raise NotImplementedError

    @abstractmethod
    def read(self, filename: str) -> bytes:
        raise NotImplementedError

    @abstractmethod
    def exists(self, filename):
        raise NotImplementedError

    @abstractmethod
    def delete(self, filename):
        raise NotImplementedError


class StorageProviderFactory(ABC):
    def create(self, auto_connect: bool = True) -> StorageProvider:
        raise NotImplementedError
